'use strict'
const { Model } = require('sequelize')
module.exports = (sequelize, DataTypes) => {
    class comment extends Model {
        static associate(models) {

        }
    };
    comment.init({
        id: {
            type: DataTypes.INTEGER,
            allowNull: false,
            primaryKey: true,
            autoIncrement: true,
        },
        content_id: {
            type: DataTypes.INTEGER,
            allowNull: false,
            references: {
                model: Model.content,
                key: 'id'
            }
        },
        user_id: {
            type: DataTypes.INTEGER,
            allowNull: false,
            references: {
                model: Model.user,
                key: 'id'
            }
        },
        content: {
            type: DataTypes.STRING(1000),
            allowNull: false,
            defaultValue: ''
        }
    }, {
        sequelize,
        modelName: 'comment'
    });
    return comment
}